package 策略模式.简单工厂模式实现;

import 策略模式.简单工厂模式加策略模式.Payment;

/**
 * 文 件 名 称：策略模式.简单工厂模式实现.Factory.
 * 文 件 说 明：
 * 创   建   人：zpen.
 * 创 建 时 间：2018/5/3 15:59.
 */
public class Factory {
    public Payment getPayType(String type, Integer price, Integer number){
        Payment payment =null;
        switch (type){
            case "discount":

                payment= new Discount(price*number,0.8);
                break;
            case "reduce":
                payment= new Reduce(price*number,500,100);
                break;
            case "normal":
               payment= new Normal(price*number);
                break;
        }
        return payment;
    }
}
